package fr.umlv.m2.recipes.ideas;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TextView;


/**
 * Activity for the About Page
 * @author Younes Chandarli et Christophe Chillan
 *
 */
public class AboutView extends Activity {
	private TextView aboutTextView;
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		
		aboutTextView = (TextView) findViewById(R.id.abouttext);
		StringBuilder builder = new StringBuilder();
		
		builder.append("RECIPES IDEAS").append("\n");
		builder.append("version 1.0").append("\n");
		builder.append("Tous droits réservés - Copyright © 2011");
		aboutTextView.setText(builder.toString());
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.mainmenu, menu);
		return true;
	}

	/**
	 * Use to Define the Option Menu
	 */
	public boolean onOptionsItemSelected(MenuItem item) {
		// On regarde quel item a été cliqué grâce à son id et on déclenche une
		// action
		switch (item.getItemId()) {
			case R.id.home:
				startActivity(new Intent(this, MenuTabWidget.class));
				return true;
			case R.id.about:
				startActivity(new Intent(this, AboutView.class));
				return true;
			default:
		        return super.onOptionsItemSelected(item);
			}
		
	}

}
